{template 'header', $module}
{if $type == 3}
	<div class="menu">
	<table cellpadding="0" cellspacing="0">
	<tr>
	<td class="tab" id="Tab0"><a href="javascript:Tab(0);" onfocus="this.blur();"><span><img src="image/add_bg.gif" width="12" height="12" align="absmiddle"/> 发起新对话</span></a></td>
	<td class="tab_nav">&nbsp;</td>
	<td class="tab" id="Tab1"><a href="javascript:Tab(1);"onfocus="this.blur();"><span>收到的对话<span class="px10">({count($T)})</span></span></a></td>
	<td class="tab_nav">&nbsp;</td>
	<td class="tab" id="Tab2"><a href="javascript:Tab(2);"onfocus="this.blur();"><span>发起的对话<span class="px10">({count($F)})</span></span></a></td>
	</tr>
	</table>
	</div>

	<div id="Tabs0" style="display:none;">
	<form action="chat.php" onsubmit="return check();" target="_blank" id="dform">
	<table cellpadding="6" cellspacing="1" class="tb">
	<tr>
	<td class="tl"><span class="f_red">*</span> 输入会员名</td>
	<td class="tr">
	<input type="text" size="20" name="touser" id="touser"/> 
	<input type="submit" value=" 开始对话 " class="btn"/>
	<span id="dtouser" class="f_red"></span></td>
	</tr>
	</table>
	</form>
	<script type="text/javascript">
	function check() {
		if(Dd('touser').value.length < 2) {
			Dmsg('请输入会员名', 'touser');
			return false;
		}
		return true;
	}
	</script>
	</div>

	<div id="Tabs1" style="display:none;">
		<div class="bd">
		{if $T}
		<table cellpadding="1" cellspacing="0" class="tb">
		<tr>
		<th>发起人</th>
		<th>来自</th>
		<th>姓名</th>
		<th>状态</th>
		<th width="150">时间</th>
		<th width="100">操作</th>
		<th width="60">来源页面</th>
		</tr>
		{loop $T $v}
		<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
		<td height="25" align="left">&nbsp;&nbsp;
		<img src="image/ico_newchat.gif" align="absmiddle"/>&nbsp;{$v[fromuser]}
		</td>
		<td>{if $v[linkurl]}<a href="{$v[linkurl]}" class="t" target="_blank">{/if}{$v[from]}{if $v[linkurl]}</a>{/if}</td>
		<td>{$v[truename]}</td>
		<td>{$S[$v[status]]}</td>
		<td>{$v[addtime]}</td>
		<td class="f_gray">
		{if $v[status] == 0}
		<a href="chat.php?chatid={$v[chatid]}" target="chat_{$v[chatid]}" class="t">查看</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=del" onclick="return confirm('确定要删除此对话吗？');" class="t">删除</a>
		{elseif $v[status] == 1}
		<a href="chat.php?chatid={$v[chatid]}&action=del" onclick="return confirm('确定要删除此对话吗？');" class="t">删除</a>
		{elseif $v[status] == 2}
		<a href="chat.php?chatid={$v[chatid]}" target="chat_{$v[chatid]}" class="t">接受</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=deny" onclick="return confirm('确定要拒绝此对话吗？');" class="t">拒绝</a>
		{elseif $v[status] == 3}
		<a href="chat.php?chatid={$v[chatid]}" target="chat_{$v[chatid]}" class="t">查看</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=off" onclick="return confirm('确定要断开此对话吗？');" class="t">断开</a>
		{elseif $v[status] == 4}
		<a href="chat.php?chatid={$v[chatid]}" target="chat_{$v[chatid]}" class="t">查看</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=del" onclick="return confirm('确定要删除此对话吗？');" class="t">删除</a>
		{/if}
		</td>
		<td>
		{if $v[forward]}
		<a href="{$v[forward]}" target="_blank" class="t">点击访问</a>
		{else}
		---
		{/if}
		</td>
		</tr>
		{/loop}
		</table>
		{else}
		<br/><br/><br/><br/><br/>
		<center>{if $_username}暂未收到对话请求，或者对话请求已经过期{else}您还没有登录，无法收到对话请求{/if}</center>
		{/if}
		</div>
	</div>

	<div id="Tabs2" style="display:none;">
		<div class="bd">
		{if $F}
		<table cellpadding="1" cellspacing="0" class="tb">
		<tr>
		<th>接收人</th>
		<th>来自</th>
		<th>姓名</th>
		<th>状态</th>
		<th width="150">时间</th>
		<th width="100">操作</th>
		<th width="60">来源页面</th>
		</tr>
		{loop $F $v}
		<tr onmouseover="this.className='on';" onmouseout="this.className='';" align="center">
		<td height="25" align="left">&nbsp;&nbsp;
		<img src="image/ico_newchat.gif" align="absmiddle"/>&nbsp;{$v[touser]}
		</td>
		<td><a href="{$v[linkurl]}" class="t" target="_blank">{$v[from]}</a></td>
		<td>{$v[truename]}</td>
		<td>{$S[$v[status]]}</td>
		<td>{$v[addtime]}</td>
		<td>
		{if $v[status] == 0}
		<a href="chat.php?touser={$v[touser]}" target="chat_{$v[touser]}" class="t">查看</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=del&tab=2" onclick="return confirm('确定要删除此对话吗？');" class="t">删除</a>
		{elseif $v[status] == 1}
		--
		{elseif $v[status] == 2}
		<a href="chat.php?touser={$v[touser]}" target="chat_{$v[touser]}" class="t">查看</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=del&tab=2" onclick="return confirm('确定要删除此对话吗？');" class="t">删除</a>
		{elseif $v[status] == 3}
		<a href="chat.php?touser={$v[touser]}" target="chat_{$v[touser]}" class="t">查看</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=off&tab=2" onclick="return confirm('确定要断开此对话吗？');" class="t">断开</a>
		{elseif $v[status] == 4}
		<a href="chat.php?touser={$v[touser]}" target="chat_{$v[touser]}" class="t">连接</a> | 
		<a href="chat.php?chatid={$v[chatid]}&action=del&tab=2" onclick="return confirm('确定要删除此对话吗？');" class="t">删除</a>
		{/if}		
		</td>
		<td>
		{if $v[forward]}
		<a href="{$v[forward]}" target="_blank" class="t">点击访问</a>
		{else}
		---
		{/if}
		</td>
		</tr>
		{/loop}
		</table>
		{else}
		<br/><br/><br/><br/><br/>
		<center>暂未发起对话请求</center>
		{/if}
		</div>
	</div>
	<script type="text/javascript">
	{if $tab>-1}
		Tab({$tab});
	{else}
		{if $_username}
			Tab(1);
		{else}
			Tab(2);
		{/if}
	{/if}
	setTimeout('window.location.reload();', 60000);
	</script>
{else}
	<link rel="stylesheet" type="text/css" href="image/chat.css"/>
	{if $type == 4}
	<div class="gb_tip"><strong>{$user[company]}</strong> [{$touser}] 当前处于<span class="f_red">离线</span>状态，无法收到对话信息，请在下面给Ta留言</div>
	<div class="gb_box"><iframe src="{$MODULE[4][linkurl]}home.php?action=message&job=guestbook&template=homepage&skin=default&username={$touser}&sign={crypt_sign('homepagedefault'.$touser)}" name="fra" id="fra" style="width:98%;height:488px;" scrolling="no" frameborder="0"></iframe></div>
	{else}
	<script type="text/javascript">
	if(window.screen.width<1200){c(0);Dh('side');Dd('side_oh').className = 'side_s';}
	if(navigator.userAgent.indexOf('Firefox') != -1) document.write('<style>#chat{background-attachment:inherit;}</style>');
	var chat_id = '{$chat_id}';
	var chat_poll = {$chat_poll};
	var chat_maxlen = {$MOD[chat_maxlen]};
	var chat_mintime = {$MOD[chat_mintime]};
	var chat_status = {$chat_status};
	var chat_type = {$type};
	var chat_last = {$DT_TIME};
	var chat_title = document.title;
	var chat_lang = {
		ec1:'按Enter键发送消息，按Ctrl+Enter键换行',
		ec2:'按Ctrl+Enter键发送消息，按Enter键换行',
		tip:'提示：系统不长久保存您的对话记录，关闭对话窗口将可能导致记录丢失，如果需要保存，请在交谈完毕之后点保存按钮',
		last:'ok'
	};
	</script>	
	<iframe src="" name="send" id="send" style="display:none;"></iframe>
	<div id="chat"></div>
	<div id="font" style="display:none;">
		<table cellspacing="0" cellpadding="0" width="100%">
		<tr>
		<td width="8" height="30"></td>
		<td width="120">
		<select id="font_s" onchange="font_init();">
			<option value="0">大小</option>
			<option value="10">10</option>
			<option value="11">11</option>
			<option value="12">12</option>
			<option value="13">13</option>
			<option value="14">14</option>
			<option value="16">16</option>
			<option value="18">18</option>
			<option value="20">20</option>
			<option value="24">24</option>
		</select>&nbsp;
		<select id="font_c" onchange="font_init();">
			<option value="0">颜色</option>
			<option value="1" style="background:#000000;">黑</option>
			<option value="2" style="background:#FF0000;">红</option>
			<option value="3" style="background:#0000FF;">蓝</option>
			<option value="4" style="background:#008040;">绿</option>
			<option value="5" style="background:#FF6600;">橙</option>
			<option value="6" style="background:#FF00FF;">粉</option>
		</select>
		</td>
		<td class="tool_a" id="tool_font_b" onclick="this.className=this.className=='tool_a' ? 'tool_b' : 'tool_a';font_init();"><img src="image/chat_font_b.gif" width="16" height="16" title="加粗"/></td>
		<td class="tool_a" id="tool_font_i" onclick="this.className=this.className=='tool_a' ? 'tool_b' : 'tool_a';font_init();"><img src="image/chat_font_i.gif" width="16" height="16" title="倾斜"/></td>
		<td class="tool_a" id="tool_font_u" onclick="this.className=this.className=='tool_a' ? 'tool_b' : 'tool_a';font_init();"><img src="image/chat_font_u.gif" width="16" height="16" title="下划线"/></td>
		<td>&nbsp;</td>
		<td class="c_p" width="15" onclick="font_hide();" title="点击关闭"><img src="image/close.gif"/></td>
		</tr>
		</table>
	</div>
	<div id="tool">
		<table cellspacing="0" cellpadding="0" width="100%">
		<tr>
		<td width="4">
			<div id="face" style="display:none;">
				<div><span onclick="face_hide();" title="点击关闭"><img src="image/close.gif"/></span><strong>选择表情</strong></div>
				{if $faces}
				<table cellspacing="0" cellpadding="0" title="点击选择">
				{loop $faces $k $v}
				{if $k%10==0}<tr>{/if}
				<td onmouseover="this.style.backgroundColor='#E3EEF3';" onmouseout="this.style.backgroundColor='';"><img src="face/{$v}.gif" onclick="face_into('{$v}');"/></td>
				{if $k%10==9}</tr>{/if}
				{/loop}
				</table>
				{/if}
			</div>
		</td>
		<td class="tool_a" onmouseover="this.className='tool_b';" onmouseout="if(Dd('font').style.display=='none')this.className='tool_a';" id="tool_font" onclick="font_show();"><img src="image/chat_font.gif" width="16" height="16" title="设置文字颜色和格式"/></td>
		<td class="tool_a" onmouseover="this.className='tool_b';" onmouseout="if(Dd('face').style.display=='none')this.className='tool_a';" id="tool_face" onclick="face_show();"><img src="image/chat_face.gif" width="16" height="16" title="表情"/></td>
		{if $MOD[chat_file] && $MG[upload]}
		<td class="tool_a" onmouseover="this.className='tool_b';" onmouseout="this.className='tool_a';" id="tool_file" onclick="Dfile({$moduleid}, '', 'chat', '{$MOD[chat_ext]}');"><img src="image/chat_file.gif" width="16" height="16" title="传文件"/></td>
		{/if}
		<td>&nbsp;</td>
		<td class="tool_a" onmouseover="this.className='tool_b';" onmouseout="this.className='tool_a';" id="tool_log" onclick="chat_log();"><img src="image/chat_log.gif" width="16" height="16" title="查看对话记录"/></td>
		<td class="tool_a" onmouseover="this.className='tool_b';" onmouseout="this.className='tool_a';" id="tool_save" onclick="chat_save();"><img src="image/chat_save.gif" width="16" height="16" title="保存对话记录"/></td>
		<td class="tool_a" onmouseover="this.className='tool_b';" onmouseout="this.className='tool_a';" id="tool_clear" onclick="Dd('chat').innerHTML='';"><img src="image/chat_clear.gif" width="16" height="16" title="清屏"/></td>
		</tr>
		</table>
	</div>
	<div class="word"><textarea id="word" onkeydown="return chat_key(event);" onfocus="Dh('ec');font_hide();face_hide();new_tip_stop();" class="f_gray" onclick="if(this.value==chat_lang.tip)this.value='';this.className='';"></textarea><script type="text/javascript">Dd('word').value=chat_lang.tip;</script></div>
	<div id="btns">
		<table cellspacing="0" cellpadding="0" width="100%">
		<tr>
		<td width="5"><img src="image/chat_foot_l.gif" width="5" height="30"/></td>
		<td><div id="tip" style="display:none;"></div></td>
		<td>&nbsp;</td>
		<td width="62"><img src="image/chat_c1.gif" width="69" height="21" onmouseover="this.src='image/chat_c2.gif';" onmouseout="this.src='image/chat_c1.gif';" onclick="chat_off();"/></td>
		<td width="8"> </td>
		<td width="62"><img src="image/chat_s1.gif" width="62" height="21" onmouseover="this.src='image/chat_s2.gif';" onmouseout="this.src='image/chat_s1.gif';" onclick="chat_send();" id="chat_s"/></td>
		<td width="21"><div id="ec" style="display:none;" onmouseover="Ds('ec');" onmouseout="Dh('ec');">
		<span id="ec1"><a href="javascript:ec_set(1);">按Enter键发送消息</a></span>
		<span id="ec2"><a href="javascript:ec_set(2);">按Ctrl+Enter键发送消息</a></span>
		</div><img src="image/chat_e1.gif" width="21" height="21" onmouseover="this.src='image/chat_e2.gif';" onmouseout="this.src='image/chat_e1.gif';" onclick="Ds('ec');"/></td>
		<td width="5"><img src="image/chat_foot_r.gif" width="5" height="30"/></td>
		</tr>
		</table>
	</div>
	<div id="sd"></div>
	<form method="post" action="chat.php" name="down" id="down" target="send">
	<input type="hidden" name="action" value="down"/>
	<input type="hidden" name="chatid" value="{$chatid}"/>
	<input type="hidden" name="data" value="" id="down_data"/>
	</form>
	<script type="text/javascript" src="{DT_PATH}file/script/chat.js"></script>
	{if $MOD[chat_file] && $MG[upload]}<script type="text/javascript" src="{DT_PATH}file/script/clear.js"></script>{/if}
	{/if}
</td>
<td width="8">&nbsp;</td>
<td valign="top" class="i_rt">
<div class="i_head">
<strong>对方信息</strong>
</div>
<div class="i_body">
	<div class="i_user">
	<table cellpadding="6" cellspacing="0" width="100%">
	{if $user[type] == 'guest'}
	<tr>
	<td class="i_user_l">会员类型</td>
	<td>游客</td>
	</tr>
	<tr>
	<td class="i_user_l">所在IP</td>
	<td>{$user[ip]}</td>
	</tr>
	<tr>
	<td class="i_user_l">所在地区</td>
	<td>{$user[area]}</td>
	</tr>
	{else}
	<tr>
	<td class="i_user_l">公司名称：</td>
	<td><a href="{$user[linkurl]}" target="_blank" class="l">{$user[company]}</a></td>
	</tr>
	<tr>
	<td class="i_user_l">在线状态：</td>
	<td>{if $online == 1}<font class="f_red">当前在线</font>{else}<font class="f_gray">当前离线</font>{/if}</td>
	</tr>
	<tr>
	<td class="i_user_l">认证情况：</td>
	<td{if $user[validated]} title="企业资料通过{$user[validator]}认证"{/if}>
	{if $user[vip]}&nbsp;<img src="{DT_SKIN}image/vip.gif" align="absmiddle" title="{VIP}:{$user[vip]}"/>{/if}
	{if $user[vcompany]}&nbsp;<img src="image/v_company.gif" width="16" height="16" align="absmiddle" title="通过工商认证"/>{/if}
	{if $user[vtruename]}&nbsp;<img src="image/v_truename.gif" width="16" height="16" align="absmiddle" title="通过实名认证"/>{/if}
	{if $user[vbank]}&nbsp;<img src="image/v_bank.gif" width="16" height="16" align="absmiddle" title="通过银行帐号认证"/>{/if}
	{if $user[vmobile]}&nbsp;<img src="image/v_mobile.gif" width="16" height="16" align="absmiddle" title="通过手机认证"/>{/if}
	{if $user[vemail]}&nbsp;<img src="image/v_email.gif" width="16" height="16" align="absmiddle" title="通过邮件认证"/>{/if}
	&nbsp;	
	</td>
	</tr>
	<tr>
	<td class="i_user_l">公司地址：</td>
	<td>{$user[address]}&nbsp;</td>
	</tr>
	{if $user[postcode]}
	<tr>
	<td class="i_user_l">邮政编码：</td>
	<td>{$user[postcode]}</td>
	</tr>
	{/if}
	<tr>
	<td class="i_user_l">公司电话：</td>
	<td>{$user[telephone]}</td>
	</tr>
	{if $user[fax]}
	<tr>
	<td class="i_user_l">公司传真：</td>
	<td>{$user[fax]}</td>
	</tr>
	{/if}
	{if $user[mail]}
	<tr>
	<td class="i_user_l">电子邮件：</td>
	<td>{$user[mail]}</td>
	</tr>
	{/if}
	{if $user[truename]}
	<tr>
	<td class="i_user_l">联 系 人：</td>
	<td>{$user[truename]} （{if $user[gender]==1}先生{else}女士{/if}）</td>
	</tr>
	{/if}
	{if $user[department]}
	<tr>
	<td class="i_user_l">部门职位：</td>
	<td>{$user[department]}{if $user[career]} （{$user[career]}）{/if}</td>
	</tr>
	{/if}
	{if $user[mobile]}
	<tr>
	<td class="i_user_l">手机号码：</td>
	<td>{$user[mobile]}{if $DT[sms] && $user[vmobile]}&nbsp;&nbsp;<a href="sms.php?action=add&auth={encrypt($user[mobile])}" target="_blank"><img src="{DT_SKIN}image/sendsms.gif" align="absmiddle" title="发送短信" alt=""/></a>{/if}</td>
	</tr>
	{/if}
	<tr>
	<td class="i_user_l">即时通讯：</td>
	<td>
	{if $user[qq] && $DT[im_qq]}{im_qq($user[qq])}&nbsp;{/if}
	{if $user[ali] && $DT[im_ali]}{im_ali($user[ali])}&nbsp;{/if}
	{if $user[msn] && $DT[im_msn]}{im_msn($user[msn])}&nbsp;{/if}
	{if $user[skype] && $DT[im_skype]}{im_skype($user[skype])}&nbsp;{/if}
	</td>
	</tr>
	{/if}
	{if ($type == 2 || $type == 4) && $chat[forward]}
	<tr>
	<td class="i_user_l">来源页面：</td>
	<td><a href="{$chat[forward]}" target="_blank" class="l">点击访问</a></td>
	</tr>
	{/if}
	</table>
	</div>
</div>
</td>
</tr>
</table>
{/if}
{template 'footer', $module}